<?
$editable = canEditBasicInfo($user->getId());

$fetch = MySQL_Fetch_Array(getUser($user->getId()));
if($action == ACTION_CHANGE_PROFILE) {
    if($_GET['edit'] == "basic") {
    	$ch_email = $fetch["EMAIL"];
    } else if ($_GET['edit'] == "other") {
    	$ch_username = $fetch["NICK"];
    	$ch_name = $fetch["JMENO"];
    	$ch_surname = $fetch["PRIJMENI"];	
    }
} else {
	$ch_username = $fetch["NICK"];
    $ch_name = $fetch["JMENO"];
    $ch_surname = $fetch["PRIJMENI"];	
    $ch_email = $fetch["EMAIL"];
}
?>

<div class="center">

<form class="centered pct50" action="<? echo redirect_str(PAGE_USER_PROFILE).action(ACTION_CHANGE_PROFILE).add_par("edit=basic"); ?>" method="post">
    <fieldset>
      <legend>Základní údaje</legend>
      <table class="centered grid">
        <tr <? if($editable) echo "class='novisible'"; ?>>
        	<td colspan=2><span class="star"><? echo "Tyto údaje je možné měnit jednou za ".PROFILE_CHANGE_DELAY." dní."; ?></span></td>
        </tr>
        
        <tr>
          <th class="px120">uživatelské jméno <span class="star">*</span></th>
          <td class="px170"><input class='text full <? if(!$editable) echo "readonly"; ?>' <? echo ($editable?"":"readonly='true'"); ?> type='text' maxlength="15" id='ch_username' name='ch_username' value="<? echo $ch_username;?>"></td>
        </tr>
        
        <tr>
          <th>jméno <span class="star">*</span></th>
          <td><input class='text full <? if(!$editable) echo "readonly"; ?>' <? echo ($editable?"":"readonly='true'"); ?> type='text' maxlength="30" id='ch_name' name='ch_name' value="<? echo $ch_name;?>"></td>
        </tr>
        
        <tr>
          <th>příjmení <span class="star">*</span></th>
          <td><input class='text full <? if(!$editable) echo "readonly"; ?>' <? echo ($editable?"":"readonly='true'"); ?> type='text' maxlength="30" id='ch_surname' name='ch_surname' value="<? echo $ch_surname;?>"></td>
        </tr>
        
        <tr>
          <td colspan=2 class="center"><span class="star">* povinné údaje</span></td>
        </tr>
      </table>
      
      <div class="center <? if(!$editable) echo "novisible"; ?>"><input class="button" onmouseover="this.className='button_hover'" 
       onmouseout="this.className='button'" type="submit" value="ULOŽIT ZMĚNY"></div>
       
    </fieldset>
</form>

<form class="centered pct50" action="<? echo redirect_str(PAGE_USER_PROFILE).action(ACTION_CHANGE_PASSWORD); ?>" method="post">
    <fieldset>
      <legend>Změna hesla</legend>
      <table class="centered grid">
        
        <tr>
          <th class="px120">staré heslo <span class="star">*</span></th>
          <td class="px170"><input class='text full' type='password' maxlength="30" id='pass_old' name='pass_old' value=""></td>
        </tr>
        
        <tr>
          <th>nové heslo <span class="star">*</span></th>
          <td><input class='text full' type='password' maxlength="30" id='pass_new' name='pass_new' value=""></td>
        </tr>
        
        <tr>
          <th>nové heslo znovu <span class="star">*</span></th>
          <td><input class='text full' type='password' maxlength="30" id='pass_new_again' name='pass_new_again' value=""></td>
        </tr>
        
      </table>
      
      <div class="center"><input class="button" onmouseover="this.className='button_hover'" 
       onmouseout="this.className='button'" type="submit" value="ZMĚNIT"></div>
       
    </fieldset>
</form>

<form class="centered pct50" action="<? echo redirect_str(PAGE_USER_PROFILE).action(ACTION_CHANGE_PROFILE).add_par("edit=other"); ?>" method="post">
    <fieldset>
      <legend>Ostatní údaje</legend>
      <table class="centered grid">
        <tr>
          <th class="px120">email <span class="star">*</span></th>
          <td class="px170"><input class='text full' type='text' maxlength="30" id='ch_email' name='ch_email' value="<? echo $ch_email;?>"></td>
        </tr>
        
        <tr>
          <td colspan=2 class="center"><span class="star">* povinné údaje</span></td>
        </tr>
      </table>
      
      <div class="center"><input class="button" onmouseover="this.className='button_hover'" 
       onmouseout="this.className='button'" type="submit" value="ULOŽIT ZMĚNY"></div>
       
    </fieldset>
</form>

</div>